package com.diandian.backend.dingding.data.param;

import com.diandian.base.boot.starter.exception.DefaultException;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

public class DingdingStaffSalaryPageOpenApiParam implements Serializable {

	private Integer pageNum;
	private Integer pageSize;

	private String queryUserJobNumber; // 查询人的工号，用来做权限过滤，生成deptPathPrefix，不用来直接做查询过滤
	private String queryUserChoiceDeptCode; // 查询人的组织编码

	private String belong;
	private String jobNumber; // 要查询的指定人的工号
	private String salarySchedule; // 工资具体日期
	private String salaryScheduleBefore; // 工资开始日期
	private String salaryScheduleAfter; // 工资截止日期
	private String title; // 岗位
	private String level; // 门店等级
	private String star; // 员工星级
	private String xinghuoTier; // 星火坎级
	private String salaryTitle; // 工资职位
 	private String recommendBrand; // 主推品牌
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date hiredDateBefore; // 入职开始时间
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date hiredDateAfter; // 入职截止时间
	private String hiredDateType; // 1：一年以下 2：1-3年 3：3年以上；传入此字段且值有效的情况下，优先使用此字段

	private String deptPathPrefix; // 区域和门店过滤使用组织path的前匹配实现

	public void check(){
		if(this.pageNum == null || this.pageNum < 1 || this.pageSize == null || this.pageSize < 1){
			throw new DefaultException("分页参数不合法");
		}
		if(this.belong == null || this.belong.equals("")){
			throw new DefaultException("归属标识不能为空");
		}
//		if(this.queryUserJobNumber == null || this.queryUserJobNumber.equals("")){
//			throw new DefaultException("工号不能为空");
//		}
//		if(this.queryUserChoiceDeptCode == null || this.queryUserChoiceDeptCode.equals("")){
//			throw new DefaultException("部门编码不能为空");
//		}
	}

	public void hiredDateHandler(){
		if(this.hiredDateType != null && !this.hiredDateType.equals("")){

			Calendar calendarOne = Calendar.getInstance();
			calendarOne.setTime(new Date());
			calendarOne.add(Calendar.YEAR, -1);

			Calendar calendarThird = Calendar.getInstance();
			calendarThird.setTime(new Date());
			calendarThird.add(Calendar.YEAR, -3);

			if("1".equals(this.hiredDateType)){
				this.hiredDateBefore = calendarOne.getTime();
				this.hiredDateAfter = null;
			} else if("2".equals(this.hiredDateType)){
				this.hiredDateBefore = calendarThird.getTime();
				this.hiredDateAfter = calendarOne.getTime();
			} else if("3".equals(this.hiredDateType)){
				this.hiredDateAfter = calendarThird.getTime();
				this.hiredDateBefore = null;
			}
		}
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public String getBelong() {
		return belong;
	}

	public void setBelong(String belong) {
		this.belong = belong;
	}

	public String getJobNumber() {
		return jobNumber;
	}

	public void setJobNumber(String jobNumber) {
		this.jobNumber = jobNumber;
	}

	public String getQueryUserJobNumber() {
		return queryUserJobNumber;
	}

	public void setQueryUserJobNumber(String queryUserJobNumber) {
		this.queryUserJobNumber = queryUserJobNumber;
	}

	public String getSalarySchedule() {
		return salarySchedule;
	}

	public void setSalarySchedule(String salarySchedule) {
		this.salarySchedule = salarySchedule;
	}

	public String getSalaryScheduleBefore() {
		return salaryScheduleBefore;
	}

	public void setSalaryScheduleBefore(String salaryScheduleBefore) {
		this.salaryScheduleBefore = salaryScheduleBefore;
	}

	public String getSalaryScheduleAfter() {
		return salaryScheduleAfter;
	}

	public void setSalaryScheduleAfter(String salaryScheduleAfter) {
		this.salaryScheduleAfter = salaryScheduleAfter;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDeptPathPrefix() {
		return deptPathPrefix;
	}

	public void setDeptPathPrefix(String deptPathPrefix) {
		this.deptPathPrefix = deptPathPrefix;
	}

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

	public String getStar() {
		return star;
	}

	public void setStar(String star) {
		this.star = star;
	}

	public String getRecommendBrand() {
		return recommendBrand;
	}

	public void setRecommendBrand(String recommendBrand) {
		this.recommendBrand = recommendBrand;
	}

	public Date getHiredDateBefore() {
		return hiredDateBefore;
	}

	public void setHiredDateBefore(Date hiredDateBefore) {
		this.hiredDateBefore = hiredDateBefore;
	}

	public Date getHiredDateAfter() {
		return hiredDateAfter;
	}

	public void setHiredDateAfter(Date hiredDateAfter) {
		this.hiredDateAfter = hiredDateAfter;
	}

	public String getQueryUserChoiceDeptCode() {
		return queryUserChoiceDeptCode;
	}

	public void setQueryUserChoiceDeptCode(String queryUserChoiceDeptCode) {
		this.queryUserChoiceDeptCode = queryUserChoiceDeptCode;
	}

	public String getHiredDateType() {
		return hiredDateType;
	}

	public void setHiredDateType(String hiredDateType) {
		this.hiredDateType = hiredDateType;
	}

	public String getXinghuoTier() {
		return xinghuoTier;
	}

	public void setXinghuoTier(String xinghuoTier) {
		this.xinghuoTier = xinghuoTier;
	}

	public String getSalaryTitle() {
		return salaryTitle;
	}

	public void setSalaryTitle(String salaryTitle) {
		this.salaryTitle = salaryTitle;
	}
}
